import React from "react";
import { Consumer } from "./cart";

const Child2 = () => {
  return (
    <Consumer>
      {(value) => (
        <>
          <button onClick={value.minus}>-</button>
          <span>{value.count}</span>
          <button onClick={() => value.add(2)}>+</button>
        </>
      )}
    </Consumer>
  );
};

export default Child2;
